<!-- 商品中心设计
 1.引入公共部分
 2.商品类别
 3.商品显示：商品id&商品类别id -> 商品
 -->
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <title>商品中心页面</title>
</head>
<body>
<?php 
include_once("common/init.php");
include_once("header.php");
$whereSql = "  isno=0 and status='已审核' ";
if ($_REQUEST["categoryid"]){
	$whereSql .= " and categoryid=" . $_REQUEST["categoryid"];
}
if ($_REQUEST["title"]) {
	$whereSql .= " and title like '%". $_REQUEST["title"] ."%' ";
}
// $page = $_REQUEST["page"]?$_REQUEST["page"]:"1";
// $list = db_get_page("select * from goods where $whereSql  order by id desc", $page,8);
$list = db_get_all("select * from goods where $whereSql  order by id desc");
// if ($page*1>$list["page"]*1){
// 	$page = $list["page"];
// }
// $Page = new PageWeb($list["total"],$list["page_size"], "&categoryid=".$_REQUEST["categoryid"]."&title=".$_REQUEST["title"], $page);
// $page_show = $Page->show(); 

if(!$_REQUEST["categoryid"]){$cat_title = "商品中心";}else{
$catA = db_get_row("select * from category where id=".$_REQUEST["categoryid"]);
$cat_title = $catA["title"];}
?>
<div class="m_ctr">
    <div class="ej_tctr">当前位置：<a href="index.php">首页</a> > <?php echo $cat_title;?></div>
   <div class="ej_tctr1">
        <div class="ej_t1">
            <div class="floatleft">分类：</div>
            <div class='<?php if(!$_REQUEST["categoryid"]){?>l_tcell1<?php }else{?>l_tcell<?php }?>'>
				<a href='goods.php'>全部</a>
			</div>
			<?php $cateart = db_get_all("select * from category where pid=1 order by id asc limit 10");
			foreach($cateart as $caterow) {?>
			<div class='<?php if($caterow["id"]==$_REQUEST["categoryid"]){?>l_tcell1<?php }else{?>l_tcell<?php }?>'>
				<a href='goods.php?categoryid=<?php echo $caterow["id"];?>'>
					<?php echo $caterow['title'];?>
				</a>
			</div>
			<?php
			}
			?>
		</div>
    </div>
    <div class="m_ctr1">
        <?php 
		$i=1;
		foreach($list as $row) {?>
		<div class="m_pctr1" onMouseOver="document.getElementById('x<?php echo $i;?>').className='m_pic11'" onMouseOut="document.getElementById('x<?php echo $i;?>').className='m_pic1'"  <?php if(is_int($i/4)){?> style="margin-right:0;"<?php }?>>
            <div class="m_pic1" id="x<?php echo $i;?>">
				<a href="goodsshow.php?id=<?php echo $row['id'];?>&categoryid=<?php echo $row['categoryid'];?>">
					<img src="./Public/Upload/<?php echo $row["img"];?>">
				</a>
			</div>
            <div class="m_pt11">
				<a href="goodsshow.php?id=<?php echo $row['id'];?>&categoryid=<?php echo $row['categoryid'];?>">
					<?php echo $row['title'];?>
				</a>
			</div>
            <div class="m_pt12">
				￥<?php echo $row['sprice'];?>
				&emsp;<span>￥<?php echo $row['mprice'];?></span>
			</div>
        </div>
        <?php $i = $i+1; }?>
<!--       <div id="page">
			<?php echo $page_show;?>
		</div> -->
    </div>
</div>
<?php 
	include_once("footer.php");
?>
</body>
</html>